package fight

import (
	"idle/internal/game/attr"
	"idle/internal/game/skill"
)

type IFighter interface {
	GetLv() int
	GetHp() int
	GetActionSpeedGear() int
	GetName() string
	GetAttr(attr attr.Attribute) int
}

type Fighter struct {
	Id            int
	Name          string
	Lv            int
	Hp            int
	Mana          int
	attrMap       map[attr.Attribute]int //属性
	SkillList     []*skill.Skill
	isByFire      bool //被集火
	isAttackSpeed bool //是否使用攻击速度
}

func (f *Fighter) SetAttr(attr attr.Attribute, value int) {
	f.attrMap[attr] = value
}

func (f *Fighter) GetAttr(attr attr.Attribute) int {
	if val, ok := f.attrMap[attr]; ok {
		return val
	}
	f.attrMap[attr] = 0
	return 0
}

func (f *Fighter) GetCopyAttrMap() map[attr.Attribute]int {
	result := make(map[attr.Attribute]int)
	for k, v := range f.attrMap {
		result[k] = v
	}
	return result
}
